package Server.entity;

import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * Entity - 城市商品价格
 *
 * @author xvzhe
 * @version 0.1
 *
 */
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@DynamicInsert
@DynamicUpdate
@Table(uniqueConstraints = {@UniqueConstraint(columnNames={"specId","cityId"})})

public class CityShop {
    @Id
    @GeneratedValue(generator = "NumberIdProduce")
    @GenericGenerator(name="NumberIdProduce", strategy="Server.tool.NumberIdProduce")
    private String uuid;

    /*
    *
    * 商品规格
    *
    * */
    @ManyToOne
    @JoinColumn(name = "specId")
    private  ShopSpec shopSpec;

    /*
     *
     * 城市
     *
     * */
    @ManyToOne
    @JoinColumn(name = "cityId")
    private  City city;

    @Column
    private BigDecimal money;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public ShopSpec getShopSpec() {
        return shopSpec;
    }

    public void setShopSpec(ShopSpec shopSpec) {
        this.shopSpec = shopSpec;
    }

    public City getCity() {
        return city;
    }

    public void setCity(City city) {
        this.city = city;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }
}
